//
//  SLHttpClient+Extension.swift
//  SLBlog
//
//  Created by 盼 on 2017/12/11.
//  Copyright © 2017年 pan. All rights reserved.
//

import Foundation

extension SLHttpClient {
    
    func requestStatusList(success:@escaping (_ task: URLSessionDataTask, _ list: [[String: Any]]?)->(), failure:@escaping (_ task: URLSessionDataTask?, _ error: Error)->()) {
        
        let urlStr = "https://api.weibo.com/2/statuses/home_timeline.json"
        
        request_2(method: .Get, urlStr: urlStr, params:nil, success: { (task, json) in
            
            let jsonDict = json as? [String: Any]
            
            let statuses = jsonDict?["statuses"] as? [[String: Any]]
            
            success(task, statuses)
            
        }) { (task, error) in
            failure(task, error)
            
        }
    }
    
}
